package post

import (
	"io/ioutil"
	"path"
)

type Post struct {
	Title string
	Body []byte
}

func NewPost() *Post {
	return new(Post)
}

func LoadPost(filename string) (*Post, error) {
	body,err:=ioutil.ReadFile(filename)
	if err!= nil { return nil,err }

	title:=path.Base(filename)
	post:=Post{title, body}
	return &post, err
}
